package com.farm.portal.action;

import com.farm.core.page.PageSet;
import com.farm.portal.domain.Componentdef;
import com.farm.portal.domain.Componentexcute;
import com.farm.portal.domain.Portal;
import com.farm.portal.service.PortalServiceInter;

import com.farm.web.WebSupport;
import com.farm.web.spring.BeanFactory;

/* *
 *功能：系统后台首页门户
 *详细：
 *
 *版本：v0.1
 *作者：Farm代码工程自动生成
 *日期：20141122211253
 *说明：
 */
public class FarmPortalAction extends WebSupport {
	private Portal portal;
	private Componentexcute componentExcute;
	private String key;
	private PageSet pageset;
	private Componentdef componentdef;
	private String id;

	public String view() {
		try {
			portal = portalIMP
					.getUserPortal("CONSOLE_PORTAL", getCurrentUser());
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
		return SUCCESS;
	}

	public String componentSet() {
		try {
			if (componentExcute.getCloseis().equals("1")) {
				System.out.println("open");
				componentdef = portalIMP.openUserComponent("CONSOLE_PORTAL",
						id, getCurrentUser());
			} else {
				System.out.println("close");
				componentdef = portalIMP.closeUserComponent("CONSOLE_PORTAL",
						id, getCurrentUser());
			}

		} catch (Exception e) {
			throw new RuntimeException(e);
		}
		return SUCCESS;
	}

	private final static PortalServiceInter portalIMP = (PortalServiceInter) BeanFactory
			.getBean("farm_portal_Portal_ProxyId");

	// ----------------------------------------------------------------------------------

//	private static final Logger log = Logger.getLogger(FarmPortalAction.class);

	public Portal getPortal() {
		return portal;
	}

	public void setPortal(Portal portal) {
		this.portal = portal;
	}

	public Componentexcute getComponentExcute() {
		return componentExcute;
	}

	public void setComponentExcute(Componentexcute componentExcute) {
		this.componentExcute = componentExcute;
	}

	public String getKey() {
		return key;
	}

	public void setKey(String key) {
		this.key = key;
	}

	public PageSet getPageset() {
		return pageset;
	}

	public void setPageset(PageSet pageset) {
		this.pageset = pageset;
	}

	public Componentdef getComponentdef() {
		return componentdef;
	}

	public void setComponentdef(Componentdef componentdef) {
		this.componentdef = componentdef;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	private static final long serialVersionUID = 1L;
}
